from tkinter import *
coords = [0, 0, 10, 0, 10, 10, 20, 10, 20, 30, 10, 30, 10, 20, 0, 20, 0, 0]
print('Введите значение X')
X = int(input())
print('Введите значение Y')
Y = int(input())
print('Введите коэффициент N')
N = int(input())
root = Tk()
root.title('ИТ марафон')
root.geometry("500x500")
canvas = Canvas(bg="white", width=500, height=500)
canvas.pack(anchor=CENTER, expand=1)
canvas.create_polygon(coords [0] *N+X, coords[1] *N+Y,
                      coords [2] *N+X, coords[3] *N+Y,
                      coords [4] *N+X, coords[5] *N+Y,
                      coords [6] *N+X, coords[7] *N+Y,
                      coords [8] *N+X, coords[9] *N+Y,
                      coords [10] *N+X, coords[11] *N+Y,
                      coords [12] *N+X, coords[13] *N+Y,
                      coords [14] *N+X, coords[15] *N+Y,
                      coords [16] *N+X, coords[17] *N+Y)
if N == 0 and X>=0 and X<=500 and Y>=0 and Y<=500:
    pass
else:
    if N > 0 and 0*N+X>=0 and 0*N+Y>=0 and 20*N+X<=500 and 20*N+Y<=500:
        pass
    else:
        if N < 0 and 20*N+X>=0 and 20*N+Y>=0 and 0*N+X<=500 and 0*N+Y<=500:
            pass
        else:
            print('Размер фиигуры превышает максимальный размер поля')
            exit()
root.mainloop()
